package org.gpp.proj1.communication.manager;

import org.gpp.proj1.communication.CommunicationException;
import org.gpp.proj1.communication.ConnectionException;
import org.gpp.proj1.communication.listener.OfflineClientListener;
import org.gpp.proj1.communication.listener.RequestListener;
import org.gpp.proj1.communication.protocol.Message;

public interface NetworkManager {

	public void sendMessage( String receiverID, Message message );
	
	public void broadcastMessage( Message message );
	
	public void registerRequestListener( RequestListener listener );
	
	public void registerOfflineClientListener( OfflineClientListener listener );
	
	public void stop();

	/**
	 * @param serverHost
	 * @param serverPort
	 * 
	 * @return The server's identification
	 * 
	 * @throws ConnectionException
	 */
	public String connectTo(String serverHost, int serverPort) throws ConnectionException;

	public void disconnectClient(String clientId);

	public void unregisterRequestListener( RequestListener listener );

	public String getClientIdFor(String serverId) throws CommunicationException;
}
